
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <stdexcept>
#include <Unit.h>
#include <Length.h>
#include <Volume.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Length)
{
    TEST(should be able check equation of 1 mile and 1760 yards)
    {
        ASSERT_EQ(Length(1, MILE), Length(1760, YARD));
    }

    TEST(should be able to check equation of 1 yard and 3 feet)
    {
        ASSERT_EQ(Length(1, YARD), Length(3, FEET));
    }	
    TEST(should be able to check equation of 1 MILE and 3 * 1760 feet)
    {
        ASSERT_EQ(Length(1, MILE), Length(3 * 1760, FEET));
    }

    TEST(should be able to check equation of 1 MILE and 1 MILE = 2 MILE)
    {
        ASSERT_EQ((Length(1, MILE)+Length(1, MILE)),Length(2, MILE) );
    }	
    
    TEST(should be able to check equation of 1 MILE and 1760 yards = 2 MILE)
    {
        ASSERT_EQ((Length(1, MILE)+Length(1760, YARD)),Length(2, MILE) );
    }	
    
    TEST(should be able to check equation of 1 yard and 3 feet = 2 yard)
    {
        ASSERT_EQ((Length(1, YARD)+Length(3 , FEET)),Length(2, YARD) );
    }	

    TEST(should be able to check equation of 3 feet and 1 yard = 2 yard)
    {
        ASSERT_EQ((Length(3 , FEET)+Length(1, YARD)),Length(2, YARD) );
    }  

	TEST(Length 1 YARD and Volume 1 OZ can not be compare togther)
    {
        ASSERT_THROWS((Volume(1, OZ)==Length(1, YARD)), std::invalid_argument);
    } 

    TEST(Length 1 FEET and Volume 1 TBS can not be compare togther)
    {
        ASSERT_THROWS((Volume(1, TBS)!=Length(1, FEET)), std::invalid_argument);
    } 

    TEST(Length 1 MILE and Volume 1 TSP can not be add togther)
    {
        ASSERT_THROWS((Volume(1, TSP)+Length(1, MILE)), std::invalid_argument);
    } 
};

FIXTURE(LengthUnit Printing)
{
    TEST(Print 1775 Yard to 1 Mile and 15 yard)
    {
      string outstring("1 Mile 15 Yard");
    
      Length  Yard1775(1775, YARD);
      ASSERT_EQ(Yard1775.printUnitStepString(), outstring); 
    }

    TEST(Print 0 Feet to 0 Feet)
    {
      string outstring("0 Feet");
    
      Length  Feet0(0, FEET);
      ASSERT_EQ(Feet0.printUnitStepString(), outstring); 
    }

    TEST(Print 5285 Feet to 1 Mile and 1 Yard and 2 Feet)
    {
      string outstring("1 Mile 1 Yard 2 Feet");
      Length  Feet5285(5285, FEET);
      ASSERT_EQ(Feet5285.printUnitStepString(), outstring); 
    }

    TEST(Print 1 Yard 3 Feet)
    {
      string outstring("3 Feet");
      Length  Yard1(1, YARD);
      ASSERT_EQ(Yard1.printUnitStepString(), outstring); 
    }

};

